#pragma once

#include <algorithm>
#include <BWAPI.h>
#include "UnitGroup.h"

class EnemyManager
{
public:
	EnemyManager(BWAPI::Player* enemy);
	~EnemyManager(void);

	void update();

	BWAPI::Player* player() { return mEnemy; }

	// <begin> GAMBIARRA
	static EnemyManager* self() { return _instance; }
	static EnemyManager* _instance;
	// <end> GAMBIARRA

	// Aux methods
	bool hasVisibleUnits();

	// Battle methods
	UnitGroup& getVisibleUnits() { return mVisibleUnits; }

	// Unit management methods
	void unitShowed(BWAPI::Unit* unit);
	void unitDiscovered(BWAPI::Unit* unit);
	void unitEvaded(BWAPI::Unit* unit);
	void unitDestroyed(BWAPI::Unit* unit);

private:
	BWAPI::Player* mEnemy;
	UnitGroup mUnits, mVisibleUnits;
};
